/*
 *  ground.h
 *  EPPI-0.0
 *
 *  Created by Juan Carlos Garcia Orden on 27/04/2011
 */
 
#ifndef _ground_h_
#define _ground_h_

#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iterator>
#include "mecsystem.h"
#include "body.h"
#include "point.h"

class MecSystem;

using namespace std;

class Ground : public Body
{
public:
	
	vector<vector<double> > R;	// Rotation matrix
	vector<double> cm;			// Coordinates of the center of mass

/*	Data members from the base class Body
	string name;
	int dim;
	MecSystem* parentSystem;
	vector<Component*> vComponents;
	vector<Component*> vLoads;
	vector<string> vPointNamesSurface;
	vector<Point*> vPPointSurface;
	map<string,int,less<string> > pNamePNumber;
	string outGraphFilex;
	vector<vector<double> > vLocalPoints;	// Local points, for joints and contact
*/

public:
	Ground(){}
	Ground(ifstream &, string, MecSystem*);
	~Ground(){}
	
	/** Virtual functions from base */
	void setPTPointsComp();		/** Set pointers to points in each component */
	void setPTPointsLoad();		/** Set pointers to points in each load */
	void setPPointSurface();
	void setMatAtComp();
	void getBoundary(vector<vector<string> >&);
	void writeMSH(ofstream&);
	void writeVTU(ofstream&, bool&, bool&, bool&);		
	void writeOOGL(ofstream&);
	void writeFileTemp(const double&, ofstream &);
	void setIniPosBody(vector<double>&);

	
	/** Local functions */
	
	friend void printSTLMatrix(const vector< vector<double> >& m);
	friend void rigidTransOver(vector<double>&, vector<double>&, vector<vector<double> >&);	// Rigid transformation
};

#endif